﻿using XL.Crawler.Core.Crawlers.CrawlerEventArgs;

namespace XL.Crawler.Core.Crawlers
{
    /// <summary>
    /// 爬虫接口
    /// </summary>
    public interface ICrawler
    {
        /// <summary>
        /// 开始事件
        /// </summary>
        event CrawlerEvent<StartEventArgs>? OnStartEvent;
        /// <summary>
        /// 完成事件
        /// </summary>
        event CrawlerEvent<CompletedEventArgs>? OnCompletedEvent;
        /// <summary>
        /// 异常事件
        /// </summary>
        event CrawlerEvent<ExceptionEventArgs>? OnExceptionEvent;

        /// <summary>
        /// 开始
        /// </summary>
        /// <param name="context">参数</param>
        Task StartAsync();
    }
}